package com.tungse.study.io.four;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

public class Client4 {

    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 9999);

        PrintStream ps = new PrintStream(socket.getOutputStream());
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.print("请输入消息：");
            String msg = scanner.nextLine();
            ps.println(msg);
            ps.flush();
        }

    }
}
